package com.ruoyi.system.service.impl;

import com.ruoyi.system.domain.Emplyee;
import com.ruoyi.system.domain.Evection;
import com.ruoyi.system.mapper.EmplyeeMapper;
import com.ruoyi.system.mapper.EvectionMapper;
import com.ruoyi.system.service.IEvectionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 【请填写功能名称】Service业务层处理
 *
 * @author ruoyi
 * @date 2023-10-09
 */
@Service
public class EvectionServiceImpl implements IEvectionService
{
    @Autowired
    private EvectionMapper evectionMapper;
    @Autowired
    private EmplyeeMapper emplyeeMapper;

    /**
     * 查询【请填写功能名称】
     *
     * @param id 【请填写功能名称】主键
     * @return 【请填写功能名称】
     */
    @Override
    public Evection selectEvectionById(Long id)
    {
        return evectionMapper.selectEvectionById(id);
    }

    /**
     * 查询【请填写功能名称】列表
     *
     * @param evection 【请填写功能名称】
     * @return 【请填写功能名称】
     */
    @Override
    public List<Evection> selectEvectionList(Evection evection)
    {
        List<Evection> evections = evectionMapper.selectEvectionList(evection);
        /*for (EvectionDto eve : evections) {
            Emplyee emplyee = emplyeeMapper.selectEmplyeeByEno(eve.getEno());
            eve.setName(emplyee.getName());
        }*/
        return evections;
    }

    /**
     * 新增【请填写功能名称】
     *
     * @param evection 【请填写功能名称】
     * @return 结果
     */
    @Override
    public int insertEvection(Evection evection)
    {
        evection.setApprover("薛之谦");
        return evectionMapper.insertEvection(evection);
    }

    /**
     * 修改【请填写功能名称】
     *
     * @param evection 【请填写功能名称】
     * @return 结果
     */
    @Override
    public int updateEvection(Evection evection)
    {
        return evectionMapper.updateEvection(evection);
    }

    /**
     * 批量删除【请填写功能名称】
     *
     * @param ids 需要删除的【请填写功能名称】主键
     * @return 结果
     */
    @Override
    public int deleteEvectionByIds(Long[] ids)
    {
        return evectionMapper.deleteEvectionByIds(ids);
    }

    /**
     * 删除【请填写功能名称】信息
     *
     * @param id 【请填写功能名称】主键
     * @return 结果
     */
    @Override
    public int deleteEvectionById(Long id)
    {
        return evectionMapper.deleteEvectionById(id);
    }

    //查询所有待审批状态
    @Override
    public List<Evection> selectListByStatus(Long index) {
        Evection evection = new Evection();
        evection.setStatus(index);
        List<Evection> evections = evectionMapper.selectEvectionList(evection);
        return evections;
    }


}
